<?xml version='1.0' encoding='UTF-8' ?> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:rich="http://richfaces.org/rich"
                xmlns:a4j="http://richfaces.org/a4j"
                template="../recurso/template/template.xhtml">
    
    <ui:define name="corpoDaPagina">
        <h:form id="formProdutos" >
            
                <div style="text-align:center">
                    <h:commandButton value="Fechar compra" action="#{PedidoController.fecharCompra}"  />
                </div>
                <br/>
            <rich:datascroller for="tabelaProduto" />
            <rich:spacer height="10" />
            <rich:dataTable value="#{PedidoController.tabelaProdutosDoPedido}" 
                            var="produto" 
                            id="tabelaProduto" 
                            styleClass="tableStant"
                            rows="10" align="center" >
                
                <f:facet name="header">
                    <rich:columnGroup >
                        <h:column>
                            <h:outputText value="Foto" />
                        </h:column>
                        <h:column>
                            <h:outputText value="Nome" />
                        </h:column>
                        <h:column>
                            <h:outputText value="Preço Unitário" />
                        </h:column>
                        <h:column >
                            <h:outputText value="QTD" />
                        </h:column>
                        
                        <h:column >
                            <h:outputText value="Remover um" />
                        </h:column>
                    </rich:columnGroup>
                </f:facet> 
                
                <h:column>
                    <img src="#{produto.urlFoto}" alt="#{produto.descricao}"/>
                </h:column>
                <h:column>
                    <h:outputText value="#{produto.nome}" />
                </h:column>
                <h:column>
                    <h:outputText value="#{produto.preco}" />
                </h:column>
                <h:column >
                    <h:outputText value="#{produto.estoque}" />
                </h:column>
                
                <h:column>
                    <h:commandButton value="SUB" action="#{PedidoController.removerItem}" />
                </h:column>
                
            </rich:dataTable>
        </h:form>
    </ui:define>
    
</ui:composition>
